/****************************************************************
 * <strong>MFString字符串处理类</strong>
 * <p>
 *字符串处理类
 * </p>
 *
 * @author AndyZhang 2011
 * @version 0.1
 * ToDo:
 ***************************************************************/
package com.thinkwide.data.core;

public class MFStringBuilder {
    private StringBuilder sb;

    public MFStringBuilder() {
        sb = new StringBuilder();
    }

    public MFStringBuilder appendln(String value) {
        sb.append(value).append(MFString.NewLine);
        return this;
    }

    public MFStringBuilder println(String value) {
        return appendln(value);
    }

    public MFStringBuilder print(String value) {
        return append(value);
    }

    public MFStringBuilder println(String format, Object... args) {
        String value = String.format(format, args);
        return appendln(value);
    }

    public MFStringBuilder print(String format, Object... args) {
        String value = String.format(format, args);
        return append(value);
    }

    public MFStringBuilder append(String value) {
        sb.append(value);
        return this;
    }

    public String toString() {

        return sb.toString();
    }

    public MFStringBuilder append(char value) {
        sb.append(value);
        return this;
    }

    public MFStringBuilder append(char[] value) {
        sb.append(value);
        return this;
    }

    public void clear() {
        sb.setLength(0);
    }

}
